home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2a.lha / p4-1.2a / lib / p4_defs.h < prev    next >
C/C++ Source or Header  |  1992-10-19  |  5KB  |  196 lines

  1. struct proc_info {
  2.     int port;
  3.     int switch_port;
  4.     int unix_id;
  5.     int slave_idx;
  6.     int group_id;
  7.     P4BOOL am_rm;
  8.     char host_name[HOSTNAME_LEN];
  9.     char machine_type[16];
  10. };
  11.  
  12. #define NUMAVAILS 8
  13.  
  14. struct p4_avail_buff {
  15.     int size;            /* size of message portion */
  16.     struct p4_msg *buff;
  17. };
  18.  
  19. struct p4_global_data {
  20. #   ifdef SYSV_IPC
  21.     int sysv_num_semids;
  22.     int sysv_semid[P4_MAX_SYSV_SEMIDS];
  23.     int sysv_next_lock;
  24. #   endif
  25.     struct proc_info proctable[P4_MAXPROCS];
  26.     int listener_pid;
  27.     int listener_port;
  28.     P4BOOL local_communication_only;
  29.     int local_slave_count;
  30.     int n_forked_pids;
  31.     char my_host_name[HOSTNAME_LEN];
  32.     struct p4_avail_buff avail_buffs[NUMAVAILS];
  33.     p4_lock_t avail_buffs_lock;
  34.     struct p4_queued_msg *avail_quel;
  35.     p4_lock_t avail_quel_lock;
  36.     struct p4_msg_queue shmem_msg_queues[P4_MAX_MSG_QUEUES];
  37.     int num_in_proctable;
  38.     int num_installed;
  39.     p4_lock_t slave_lock;
  40.     int dest_id[P4_MAXPROCS];
  41.     int listener_fd;
  42.     int max_connections;
  43.     int cube_msgs_out;    /* i860 msgs not yet msgwait'ed on */
  44.     long reference_time;  /* used in p4_initenv and p4_clock */
  45.     int hi_cluster_id;
  46.     int low_cluster_id;
  47.     P4VOID *cluster_shmem;
  48.     p4_barrier_monitor_t cluster_barrier;
  49.     char application_id[12];
  50. } *p4_global;
  51.  
  52.  
  53. struct connection {
  54.     int type;
  55.     int port;
  56.     int switch_port;
  57.     P4BOOL same_data_rep;
  58. };
  59.  
  60. struct local_data {        /* local to each process */
  61.     int listener_fd;
  62.     int my_id;
  63.     int local_commtype;        /* cube or shmem messages */
  64.     struct p4_msg_queue *queued_messages;
  65.     P4BOOL am_bm;
  66.     struct connection *conntab;    /* pointer to array of connections */
  67.     struct p4_procgroup *procgroup;
  68.     int soft_errors;            /* false if errors cause termination */
  69.     char *xdr_buff;
  70.     XDR xdr_enc;
  71.     XDR xdr_dec;
  72. } *p4_local;
  73.  
  74. struct listener_data {
  75.     int listening_fd;
  76.     int slave_fd;
  77. } *listener_info;
  78.  
  79.  
  80. /* this struct is similar to a p4_net_msg_hdr;  note that the sum of
  81.    the sizes of the items up to the *msg is equal to some number of 
  82.    double wrods, which is important on machines like bfly2 if you 
  83.    receive doubles into the msg area.
  84. */
  85. struct p4_msg {
  86.     struct p4_msg *link;
  87.     int type;                
  88.     int to;
  89.     int from;
  90.     int ack_req;
  91.     int len;
  92.     int msg_id;                /* for i860 messages */
  93.     int data_type;        /* for use by xdr */
  94.     char *msg;    /* variable length array of characters */
  95. };
  96.  
  97. struct p4_net_msg_hdr {
  98.     int msg_type:32;
  99.     int to:32;
  100.     int from:32;
  101.     int ack_req:32;
  102.     int msg_len:32;
  103.     int msg_id:32;        /* for i860 messages */
  104.     int data_type:32;        /* for use by xdr */
  105.     int pad:32;                 /* pad field to word boundary */
  106. };
  107.  
  108. struct net_initial_handshake {
  109.    int pid:32;
  110.    int pad:32;
  111. };
  112.  
  113. struct p4_queued_msg {
  114.     struct p4_msg *qmsg;
  115.     struct p4_queued_msg *next;
  116. };
  117.  
  118.  
  119. /* Messages between a listener and any other non-listener */
  120.  
  121. #define DIE   1
  122. #define SLAVE_DYING   2     /* Unused.  Check for whole data struct. */
  123. #define CONNECTION_REQUEST   3
  124. #define IGNORE_THIS   4
  125.  
  126. struct slave_listener_msg {
  127.     int type:32;
  128.     int from:32;
  129.     int to:32;
  130.     int to_pid:32;
  131.     int lport:32;
  132.     int pad:32;
  133. };
  134.  
  135. /* Messages between the bm and a rm at startup */
  136.  
  137. #define INITIAL_INFO            11
  138. #define REMOTE_LISTENER_INFO    12
  139. #define REMOTE_SLAVE_INFO       13
  140. #define REMOTE_MASTER_INFO      14
  141. #define REMOTE_SLAVE_INFO_END   15
  142. #define PROC_TABLE_ENTRY        16
  143. #define PROC_TABLE_END          17
  144. #define SYNC_MSG                18
  145.  
  146. struct bm_rm_msg {
  147.     int type:32;
  148.  
  149.     /* for INITIAL_INFO */
  150.     int numslaves:32;
  151.     int numinproctab:32;
  152.     int memsize:32;
  153.     int rm_num:32;
  154.     int debug_level:32;
  155.     int logging_flag:32;
  156.  
  157.     /* for REMOTE_LISTENER_INFO */
  158.     int port:32;
  159.  
  160.     /* for REMOTE_SLAVE_INFO and REMOTE_MASTER_INFO */
  161.     int slave_idx:32;
  162.     int slave_pid:32;
  163.     int am_rm:32;
  164.  
  165.     /* for PROC_TABLE_ENTRY */
  166.     int unix_id:32;
  167.     int group_id:32;
  168.     int switch_port:32;
  169.     /* int pad:32;  to keep number of 32 bit quantities even */
  170.     char host_name[HOSTNAME_LEN];
  171.  
  172.     /* also for INITIAL INFO */
  173.     char pgm[128];
  174.     char version[8];
  175.     char outfile[128];
  176.     char application_id[16];
  177.     char machine_type[16];
  178. };
  179.  
  180. #define P4_ACK_REQ_MASK   1     /* Masks define bits set for requests */
  181. #define P4_ACK_REPLY_MASK 2
  182. #define P4_BROADCAST_MASK 4
  183.  
  184. struct p4_brdcst_info_struct {
  185. /*
  186.   This structure is initialized by init_p4_brdcst_info() which
  187.   is automatically called by every global operation
  188. */
  189.   int initialized;             /* True if structure is initialized */
  190.   int up;                      /* Process above me in tree         */
  191.   int left_cluster;            /* Id of left child cluster master  */
  192.   int right_cluster;           /* Id of right child cluster master */
  193.   int left_slave;              /* Id of left child slave           */
  194.   int right_slave;             /* Id of right child slave          */
  195. } p4_brdcst_info;
  196.